using System;
using System.Collections.Generic;


namespace DataObjects
{
	[Serializable]
	public class UsersLoginHistory: IEquatable<UsersLoginHistory>
	{

		#region Private Members

		private long _id; 
		private string _user_id; 
		private DateTime? _login_time; 
		private string _ip; 
		private string _computer_name; 		
		#endregion

		#region Constructor

		public UsersLoginHistory()
		{
			_id = 0; 
			_user_id = String.Empty; 
			_login_time = new DateTime?(); 
			_ip = String.Empty; 
			_computer_name = String.Empty; 
		}
		#endregion // End of Default ( Empty ) Class Constuctor

		#region Required Fields Only Constructor
		/// <summary>
		/// required (not null) fields only constructor
		/// </summary>
		public UsersLoginHistory(
			long id)
			: this()
		{
			_id = id;
			_user_id = String.Empty;
			_login_time = null;
			_ip = String.Empty;
			_computer_name = String.Empty;
		}
		#endregion // End Constructor

		#region Public Properties
			
		public virtual long Id
		{
			get
			{ 
				return _id;
			}
			set
			{
				_id = value;
			}

		}
			
		public virtual string UserId
		{
			get
			{ 
				return _user_id;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for UserId", value, value.ToString());
				
				_user_id = value;
			}
		}
			
		public virtual DateTime? LoginTime
		{
			get
			{ 
				return _login_time;
			}
			set
			{
				_login_time = value;
			}

		}
			
		public virtual string Ip
		{
			get
			{ 
				return _ip;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for Ip", value, value.ToString());
				
				_ip = value;
			}
		}
			
		public virtual string ComputerName
		{
			get
			{ 
				return _computer_name;
			}

			set	
			{	
				if(  value != null &&  value.Length > 50)
					throw new ArgumentOutOfRangeException("Invalid value for ComputerName", value, value.ToString());
				
				_computer_name = value;
			}
		}
			
				
		#endregion 

		#region Public Functions

		#endregion //Public Functions

		#region Equals And HashCode Overrides
		/// <summary>
		/// local implementation of Equals based on unique value members
		/// </summary>
		public override bool Equals( object obj )
		{
			if( this == obj ) return true;
			if( ( obj == null ) || ( obj.GetType() != this.GetType() ) ) return false;
			UsersLoginHistory castObj = (UsersLoginHistory)obj; 
			return ( castObj != null ) &&
				( this._id == castObj.Id );
		}
		
		/// <summary>
		/// local implementation of GetHashCode based on unique value members
		/// </summary>
		public override int GetHashCode()
		{
			
			int hash = 57; 
			hash = 27 ^ hash ^ _id.GetHashCode();
			return hash; 
		}
		#endregion
		
		#region IEquatable members

		public bool Equals(UsersLoginHistory other)
		{
			if (other == this)
				return true;
		
			return ( other != null ) &&
				( this._id == other.Id );
				   
		}

		#endregion
		
	}
}
